tonal-note
tonal-note
is a collection of functions to extract properties from musical notes.
This is part of tonal music theory library.
You can install via npm: npm i --save tonal-note
Read the generated API documentation.
API
tonal-note
is a collection of functions to get properties from musical notes.
Example
var note = require('tonal-note')
note.name('bb2')
note.chroma('bb2')
note.enharmonics('C#6')
note.simplify('B#3')
note.chroma(note) ⇒ Integer
Return the chroma of a note. The chroma is the numeric equivalent to the
pitch class, where 0 is C, 1 is C# or Db, 2 is D... 11 is B
Kind: static method of note
Returns: Integer
- the chroma
Param | Type |
---|
note | String | Pitch |
Example
['C', 'D', 'E', 'F'].map(_.chroma)
_.map(_.chroma, 'cb db eb fb')
note.name(n) ⇒ String
Given a note (as string or as array notation) returns a string
with the note name in scientific notation or null
if not valid note
Kind: static method of note
Example
import { noteName } from 'tonal-notes'
['c', 'db3', '2', 'g+', 'gx4'].map(noteName)
Example
var tonal = require('tonal')
tonal.noteName('cb2')
tonal.map(tonal.noteName, 'c db3 2 g+ gx4')
note.pc(n) ⇒ String
Get pitch class of a note. The note can be a string or a pitch array.
Kind: static method of note
Returns: String
- the pitch class
Example
tonal.pc('Db3')
tonal.map(tonal.pc, 'db3 bb6 fx2')
note.enharmonics(note) ⇒ Array
Get the enharmonics of a note. It returns an array of three elements: the
below enharmonic, the note, and the upper enharmonic
Kind: static method of note
Returns: Array
- an array of pitches ordered by distance to the given one
Param | Type | Description |
---|
note | String | the note to get the enharmonics from |
Example
var note = require('tonal-note')
note.enharmonics('C')
note.enharmonics('A')
note.enharmonics('C#4')
note.enharmonics('Db')
note.simplify(note) ⇒ String
Get a simpler enharmonic note name from a note if exists
Kind: static method of note
Returns: String
- the simplfiied note (if not found, return same note)
Param | Type | Description |
---|
note | String | the note to simplify |
Example
var note = require('tonal-note')
note.simplify('B#3')